home *** CD-ROM | disk | FTP | other *** search
- #include "malloc.h"
- #include <stdio.h>
-
- /* This is a program which copies too much data into a
- malloc buffer */
-
- main()
- {
- char *string1, *string2;
- string1 = malloc(4);
- string2 = malloc(6);
- strcpy(string2, "12345");
- /* about to copy too many characters into string1 */
- strcpy(string1, "ABCDEFGHIJ");
- printf("string1 = >%s<\n", string1);
- printf("string2 = >%s<\n", string2);
- free(string1);
- free(string2);
- }
-